package com.gome.ocean.dao.datax;

import java.util.List;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.session.RowBounds;
import org.springframework.stereotype.Repository;

import com.github.pagehelper.Page;
import com.gome.ocean.dao.model.datasource.DatasourceBO;

/**
 * 数据源dao
 * 
 * @author haqiaolong 2016年3月8日 上午11:50:02
 * @since 5.0.0
 */
@Repository("datasourceDAO")
public interface DatasourceDAO {

    int insertDatasourceBO(DatasourceBO datasourceBO);

    int removeDatasourceBOById(Long id);

    int updateDatasourceBOById(DatasourceBO datasourceBO);

    DatasourceBO findDatasourceBOById(Long id);

    DatasourceBO findDatasourceBOByTypeAndUrl(@Param("sourceType") String sourceType,@Param("jdbcUrl") String jdbcUrl);
    
    List<DatasourceBO> findDataSourceByType(@Param("sourceType") String sourceType);

    List<DatasourceBO> findDataSourceByTypeAndProjectNames(@Param("sourceType") String sourceType,
                                                           @Param("projectNames") List<String> projectNames);

    List<DatasourceBO> findAllDataSource();

    List<DatasourceBO> findDataSources(RowBounds rowBounds);

    Page<DatasourceBO> findAllDatasourceBOsByProjectNames(@Param("projectNames") List<String> projectNames,
                                                          RowBounds rowBounds);

    List<DatasourceBO> findDataSourcesByUser(@Param("createUser") String createUser, RowBounds rowBounds);

    List<DatasourceBO> findDataSourcesByTypeAndUser(@Param("createUser") String createUser, @Param("type") String type);

    List<DatasourceBO> findDataSourcesByCurrentUserBelongToProjects(@Param("projectNames") List<String> projectNames);

    List<DatasourceBO> findDataSourcesByProjectNamesAndType(@Param("projectNames") List<String> projectNames,
                                                            @Param("type") int type);
}
